{{- $version := "1.5.2" }}
---
image: {{ .ModuleName }}/capi-controller-manager
fromImage: common/distroless
import:
- artifact: {{ .ModuleName }}/capi-artifact
  add: /capi-controller-manager
  to: /capi-controller-manager
  before: setup
---
artifact: {{ $.ModuleName }}/capi-artifact
from: {{ $.Images.BASE_GOLANG_20_ALPINE_DEV }}
mount:
- fromPath: ~/go-pkg-cache
  to: /go/pkg
shell:
  install:
  - mkdir /src
  - export GOPROXY={{ $.GOPROXY }}
  - git clone --depth 1 --branch v{{ $version }} {{ $.SOURCE_REPO }}/kubernetes-sigs/cluster-api.git /src
  - cd /src
  - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make managers LDFLAGS="-s -w -extldflags \"-static\""
  - mv /src/bin/manager /capi-controller-manager
  - chown 64535:64535 /capi-controller-manager
  - chmod 0700 /capi-controller-manager
